﻿namespace Web.Control.WWW.Course
{
    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using System.Text.RegularExpressions;
    using System.IO;
    using Lx.Web.Common.ControlsUI;
    using Lx.Web.Common.UI;
    using BLF;
    using System.Collections.Generic;

    public class Tags : BaseControl
    {
        /// <summary>
        /// 教学语言
        /// </summary>
        protected string TL = "";
        /// <summary>
        /// Hot tags over the last week 
        /// </summary>
        protected List<string[]> TagLastWeek;
        /// <summary>
        /// All time most popular tags 
        /// </summary>
        protected List<string[]> TagAll;
        protected Repeater rptPopList;
        protected Repeater rptLastList;

        protected override void OnLoad(EventArgs e)
        {
            if (Request["tl"]!=null)
            {
                TL = Request["tl"];
                HttpCookie llCookie = new HttpCookie("italkiLearn", TL);//保存cookie
                Response.Cookies.Add(llCookie);
            }
            else {
                if (Request.Cookies["italkiLearn"] != null)
                    TL = Request.Cookies["italkiLearn"].Value == "all" ? "" : Request.Cookies["italkiLearn"].Value;
            }
            ArrayList arrList = BLF.WWW_User.Teach.Teach.GetCTags(TL);
            if (arrList != null)
            {
                TagLastWeek = arrList[0] as List<string[]>;
                TagAll = arrList[1] as List<string[]>;
                if (rptPopList != null)
                {
                    rptPopList.DataSource = arrList[2];
                    rptPopList.DataBind();
                }
                if (rptLastList != null)
                {
                    rptLastList.DataSource = arrList[3];
                    rptLastList.DataBind();
                }
            }
            else {
                Response.End();
            }
        }
       
    }
}


